<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>话费充值</title>
    <script type="text/javascript" th:src="@{js/qrcode.min.js}"></script>
    <script type="text/javascript" th:src="@{js/jquery-1.8.2.min.js}"></script>
</head>
<body>
<div id="qrcode" ></div>
<script type="text/javascript">
    //显示二维码
    new QRCode(document.getElementById("qrcode"), "${code_url}");

    //轮询订单是否支付成功
    var t1 = window.setInterval('queryStatus()', 5000);

    function queryStatus(){
        $.ajax({
            type: 'post',
            url: 'WxPayOrderQueryServlet',
            data: {orderNO:"${orderNO}"},
            success: function(str){
                console.log(str);
                if('SUCCESS' == str){
                    location.href='success.jsp?orderNO=${orderNO}';
                }
            },
            error: function(){
                alert('执行错误！');
            }
        });
    }


</script>
</body>
</html>